package io.terminus.spzx.manager.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.terminus.spzx.manager.service.ProductUnitService;
import io.terminus.spzx.model.entity.base.ProductUnit;
import io.terminus.spzx.model.vo.common.Result;
import io.terminus.spzx.model.vo.common.ResultCodeEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lichunlong lcl253137@alibaba-inc.com
 * @Desc 商品计量单位管理Controller
 * @Date 2024-10-11
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "商品计量单位管理接口")
@RequestMapping(value = "/admin/product/productUnit")
public class ProductUnitController {

    private final ProductUnitService productUnitService;

    /**
     * 查询商品计量单位列表
     *
     * @return 计量单位列表
     */
    @GetMapping("findAll")
    public Result<List<ProductUnit>> findAll() {
        List<ProductUnit> productUnitList = productUnitService.findAll();

        return Result.build(productUnitList, ResultCodeEnum.SUCCESS);
    }
}
